package models;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import play.db.jpa.Model;

@Entity
@Table(name = "trade")
public class Trade extends Model {

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "types_id")
	public Types types;
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "member_id")
	public Member member;
	@Column(name = "avaiable")
	public String avaiable;
	@Column(name = "depict")
	public String depict;
	@Column(name = "email")
	public String email;
	@Column(name = "price")
	public String price;
	@Column(name = "tel")
	public String tel;
	@Column(name = "time", length = 19)
	public Timestamp time;
	@Column(name = "title")
	public String title;
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "trade")
	public Set<TradeProductList> tradeproductlists = new HashSet<TradeProductList>(0);

	public Trade() {
	}

	public Trade(Types types, Member member, String avaiable, String depict, String email, String price, String tel,
			Timestamp time, String title, Set<TradeProductList> tradeproductlists) {
		this.types = types;
		this.member = member;
		this.avaiable = avaiable;
		this.depict = depict;
		this.email = email;
		this.price = price;
		this.tel = tel;
		this.time = time;
		this.title = title;
		this.tradeproductlists = tradeproductlists;
	}





}